using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gko.Utils
{
	/// <summary>
	/// The protection for the file view, when the file is mapped
	/// </summary>
	[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1714:FlagsEnumsShouldHavePluralNames")]
	[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32")]
	[Flags]
	[CLSCompliant(false)]
	public enum FileMappingProtection : uint
	{
		/// <summary>
		/// Sets read-only access. An attempt to write to the file view results in an access violation. The file that the hFile parameter specifies must be created with the GENERIC_READ access right.
		/// </summary>
		ReadOnly = 0x02,
		/// <summary>
		/// Sets read/write access. The file that hFile specifies must be created with the GENERIC_READ and GENERIC_WRITE access rights.
		/// </summary>
		ReadWrite = 0x04,
		/// <summary>
		/// Sets copy-on-write access. The files that the hFile parameter specifies must be created with the GENERIC_READ access right.
		/// </summary>
		WriteCopy = 0x08,
		/// <summary>
		/// Sets read and execute access. The file specified by hFile must be created with the GENERIC_READ and GENERIC_EXECUTE access rights. Windows Server 2003 and Windows XP:  This feature is not available until Windows XP SP2 and Windows Server 2003 SP1.
		/// </summary>
		ExecuteRead = 0x20,
		/// <summary>
		/// Sets read, write, and execute access. The file that hFile specifies must be created with the GENERIC_READ, GENERIC_WRITE, and GENERIC_EXECUTE access rights. Windows Server 2003 and Windows XP:  This feature is not available until Windows XP SP2 and Windows Server 2003 SP1.
		/// </summary>
		ExecuteReadWrite = 0x40,
		/// <summary>
		/// Allocates physical storage in memory or the paging file for all pages. This is the default setting.
		/// </summary>
		SectionCommit = 0x8000000,
		/// <summary>
		/// Sets the file that is specified to be an executable image file. Because the mapping information and file protection are taken from the image file, no other attributes are valid with SEC_IMAGE.
		/// </summary>
		SectionImage = 0x1000000,
		/// <summary>
		/// Enables large pages to be used when mapping images or backing from the pagefile, but not when mapping data for regular files. Be sure to specify the maximum size of the file mapping object as the minimum size of a large page reported by the GetLargePageMinimum function and to enable the SeLockMemoryPrivilege privilege. Windows XP/2000:  This flag is not supported until Windows Server 2003 SP1.
		/// </summary>
		SectionLargePages = 0x80000000,
		/// <summary>
		/// Sets all pages to non-cachable. Applications should not use this flag except when explicitly required for a device. Using the interlocked functions with memory mapped with SEC_NOCACHE can result in an EXCEPTION_ILLEGAL_INSTRUCTION exception. SEC_NOCACHE requires either the SEC_RESERVE or SEC_COMMIT to be set.
		/// </summary>
		SectionNoCache = 0x10000000,
		/// <summary>
		/// Reserves all pages without allocating physical storage. The reserved range of pages cannot be used by any other allocation operations until the range of pages is released. Reserved pages can be identified in subsequent calls to the VirtualAlloc function. This attribute is valid only if the hFile parameter is INVALID_HANDLE_VALUE; that is, a file mapping object that is backed by the operating system paging file.
		/// </summary>
		SectionReserve = 0x4000000,
	}
}